package com.online.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.online.entity.Message;
import com.online.mapper.MessageMapper;
import com.online.service.MessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class MessageServiceImpl implements MessageService {
    @Autowired
    private MessageMapper messageMapper;
    /**
     * 查看所有留言
     * @param messagePage
     * @return
     */
    @Override
    public IPage<Message> findAll(Page<Message> messagePage) {
        return messageMapper.findAll(messagePage);
    }
    /**
     * 根据id查询
     * @param id
     * @return
     */
    @Override
    public Message findById(Integer id) {
        return messageMapper.findById(id);
    }
    /**
     * 删除留言
     * @param id
     * @return
     */
    @Override
    public int delete(Integer id) {
        return messageMapper.delete(id);
    }
    /**
     * 新增留言
     * @param message
     * @return
     */
    @Override
    public int add(Message message) {
        return messageMapper.add(message);
    }
}
